package com.gym.service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gym.dao.StaffdbDao;
import com.gym.pojo.Employee;
import com.gym.pojo.Train;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class StaffdbServiceImpl implements StaffdbService{

    @Resource
    private StaffdbDao sdao;
    @Override
    public Employee login(String account, String password) {
        return sdao.login(account,password);
    }

    @Override
    public Employee selempid(int empid) {
        return sdao.selempid(empid);
    }

    @Override
    public Employee selectpwd(String account,String password) {
        return sdao.selectpwd(account,password);
    }

    @Override
    public List<Employee> selaccount(String account) {
        return sdao.selaccount(account);
    }

    @Override
    public PageInfo<Employee> select(String empname, int page, int lmit) {
        PageHelper.startPage(page, lmit);
        PageInfo<Employee> pagee =new PageInfo<Employee>(sdao.select(empname,page,lmit),5);
        return pagee;
    }

    @Override
    public boolean insert(Employee em) {
        return sdao.insert(em)>0;
    }

    @Override
    public boolean update(Employee em) {
        return sdao.update(em)>0;
    }

    @Override
    public boolean delete(int empid) {
        return sdao.delete(empid)>0;
    }

    @Override
    public boolean updatepwd(Employee em) {
        return sdao.updatepwd(em)>0;
    }

}
